package com.hjl.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ServivE
 * @version 0.1
 * @className MvcConfig
 * @description mvc的组件配置类
 * @date 2024/8/12 21:15
 * @since jdk11
 */
@Configuration
@ComponentScan("com.hjl.json")
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
    //handlerMapping handlerAdapter json转化器----》@EnableWebMvc
    //1.视图解析器，指定jsp前后缀
    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
//        registry可以快速添加前后缀
        registry.jsp("/WEB-INF/views/", ".jsp");
    }
}
